package com.waves.task.event.listener;

import com.waves.core.constant.MQConstant;
import com.waves.core.constant.redis.UserRedisKey;
import com.waves.core.utils.RedisUtils;
import com.waves.task.domain.pojo.GeoEventPOJO;
import com.waves.task.event.TaskMessageRecordEvent;
import com.waves.task.event.TaskUserGeoEvent;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 创建消息中心的通知记录
 */
@Component
public class TaskMessageRecordListener {

    @Resource
    private RabbitTemplate rabbitTemplate;

    @Order(1)
    @Async
    @EventListener
    public void handleEvent(TaskMessageRecordEvent event) {
        rabbitTemplate.convertAndSend(MQConstant.MESSAGE_RECORD_EXCHANGE,
                MQConstant.MESSAGE_RECORD_KEY, event.getPojo());
    }


}
